package com.sunyard.domee.commons.utils;

import java.util.concurrent.ThreadLocalRandom;

/**
 * @program domee
 * @description
 * @author raoinyx@163.com
 * @create 2020-07-18 00:23
 */
public class TraceIDGenerator {
	public TraceIDGenerator() {
	}

	public static String generate() {
		long currentTime = System.currentTimeMillis();
		long timeStamp = currentTime % 1000000L;
		int randomNumber = ThreadLocalRandom.current().nextInt(1000000);
		long traceId = timeStamp * 10000L + (long)randomNumber;
		return Long.toHexString(traceId).toUpperCase();
	}
}
